package juego

import org.uqbar.arena.windows.SimpleWindow
import org.uqbar.arena.windows.WindowOwner
import org.uqbar.arena.widgets.Panel
import org.uqbar.arena.widgets.List
import org.uqbar.arena.bindings.PropertyAdapter
import unq.model.Villano
import org.uqbar.arena.widgets.Button
import org.uqbar.commons.utils.Observable
import org.uqbar.arena.widgets.Label
import model.AppModel.ResolverMisterioAppModel
import org.uqbar.arena.widgets.Selector
import org.uqbar.arena.widgets.Selector
import model.AppModel.ResolverMisterioAppModel
import org.uqbar.commons.utils.Observable

@Observable
class OrdenDeArrestoWindow extends SimpleWindow<ResolverMisterioAppModel> {

	new(WindowOwner parent, ResolverMisterioAppModel model) {
		super(parent, model)

		title = "Emitir Orden de Arresto"

		title = "Resolviendo - " + modelObject.caso.nombre

	}

	override protected addActions(Panel actionsPanel) {
		//throw new UnsupportedOperationException("TODO: auto-generated method stub")
	}

	override protected createFormPanel(Panel mainPanel) {
		new Panel(mainPanel) => [
			new Label(it) => [
				text = "Lista de Posibles Responsables"
			]
			new Selector(it) => [
				bindItemsToProperty("caso.juego.listaVillanos").setAdapter(new PropertyAdapter(Villano, "nombre"))
				bindValueToProperty("villanoSeleccionado")
			]
			new Button(it) => [
				caption = "emitir orden"
				onClick [ |
					this.modelObject.darOrden
					close
				]
			]
		]
	}
}
